/**
 * 
 */
package com.lanswon.controller.admin;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import com.lanswon.common.util.ImageUtil;
import com.lanswon.entity.ImageVO;
import com.lanswon.service.ImageService;

/**
 * 
 * @ClassName: BannerController.java
 * @Description: 该类的功能描述
 *
 * @version: v1.0.0
 * @author: zm
 * @date: 2018年5月4日 下午4:40:40
 *
 */

@Controller
@RequestMapping("admin/banner/")
public class BannerController {

	/*@Autowired
	ImageService imageService;

	@RequestMapping("load")
	@ResponseBody
	public Object load(Integer page, Integer limit, String type, String content) throws IOException {
		return imageService.load(page, limit, type, content);
	}

	@RequestMapping("/update.do")
	@ResponseBody
	public  Map<String, Object>  upadte(@RequestParam(value = "file") MultipartFile file, HttpServletRequest request, Long imgId,
			String imgName){	
		return imageService.update(imgId,file,imgName);
	}

	@RequestMapping("/upload.do")
	@ResponseBody
	public  Map<String, Object>  upLoadImg(@RequestParam(value = "file") MultipartFile file, HttpServletRequest request, String type,
			String imgDesc)  {
		return imageService.save("type", "front/image/url.do?imgName=", file);
	}

	@RequestMapping("index")
	public String index(HttpServletRequest request, HttpServletResponse response) {
		return "admin/banner/banner";
	}

	@RequestMapping("edit")
	public String edit(HttpServletRequest request, HttpServletResponse response, Long imgId)
			throws ServletException, IOException {

		Map<String, Object> dataMap = imageService.getImg(imgId);

		request.setAttribute("map", dataMap);
		request.setAttribute("type", "edit");

		return "admin/banner/editAndView";
	}

	@RequestMapping("view")
	public String view(HttpServletRequest request, HttpServletResponse response, Long imgId)
			throws ServletException, IOException {

		Map<String, Object> dataMap = imageService.getImg(imgId);

		request.setAttribute("map", dataMap);
		request.setAttribute("type", "view");
		return "admin/banner/editAndView";
	}

	@RequestMapping("toUpload")
	public String upadte(HttpServletRequest request) {
		return "admin/banner/upload";
	}*/

}
